
// logo
$('#logo').change(function() {
    filePath = URL.createObjectURL(this.files[0]);
    var index= this.files[0].name.lastIndexOf(".");
    var ext = this.files[0].name.substr(index+1);
    if (['png','jpg','jpeg'].indexOf(ext)) {
        alert("文件格式不正确")
        return
    }
    $('#img').attr('src', filePath);
})

// Cps Image
$('#image').change(function() {
    filePath = URL.createObjectURL(this.files[0]);
    var index= this.files[0].name.lastIndexOf(".");
    var ext = this.files[0].name.substr(index+1);
    if (['png','jpg','jpeg'].indexOf(ext)) {
        alert("文件格式不正确")
        return
    }
    $('#cps_img').attr('src', filePath);
})

// 裂变 群头像
$('#avatar').change(function() {
    filePath = URL.createObjectURL(this.files[0]);
    var index= this.files[0].name.lastIndexOf(".");
    var ext = this.files[0].name.substr(index+1);
    if (['png','jpg','jpeg'].indexOf(ext)) {
        alert("文件格式不正确")
        return
    }
    $('#liebian_avatar_img').attr('src', filePath);
})

// 裂变 群头二维码
$('#wechat_qr_code').change(function() {
    filePath = URL.createObjectURL(this.files[0]);
    var index= this.files[0].name.lastIndexOf(".");
    var ext = this.files[0].name.substr(index+1);
    if (['png','jpg','jpeg'].indexOf(ext)) {
        alert("文件格式不正确")
        return
    }
    $('#lieban_wechat_qr_code').attr('src', filePath);
})

$('#group_avatar').change(function() {
    if (this.files.length > 0) {
        var imgStr = '';
        for (var i = 0; this.files.length > i; i++) {
            filePath = URL.createObjectURL(this.files[i]);
            imgStr += `<img src="${filePath}" alt="" width="90">`
        }
        $('#group_avatar_previe').html(imgStr)
    }
})


// 裂变 群头二维码
$('#liebian_qr_url_img').change(function() {
    filePath = URL.createObjectURL(this.files[0]);
    var index= this.files[0].name.lastIndexOf(".");
    var ext = this.files[0].name.substr(index+1);
    if (['png','jpg','jpeg'].indexOf(ext)) {
        alert("文件格式不正确")
        return
    }
    $('#liebian_qrs_url_img').attr('src', filePath);
})